package pile;

import java.util.ArrayList;

public class EmplacementMemoire {

	public ArrayList<VariablePile> linkedVars;
	public int positionMem;
	public String valeur;
	
	public EmplacementMemoire(VariablePile linkvar, int positionMem, String valeur){
		linkedVars = new ArrayList<VariablePile>();
		linkedVars.add(linkvar);
		this.positionMem = positionMem;
		this.valeur = valeur;
	}
	
	public void removeLinkVar(String varName){
		int i=0;
		boolean removed = false;
		while( (i<linkedVars.size())&&(!removed)){
			VariablePile var = linkedVars.get(i);
			if(var.name.equals(varName)){
				linkedVars.remove(i);
				removed = true;
			}
			i++;
		}
	}
	
	public boolean isNotLinked(){
		return linkedVars.isEmpty();
	}
	
}
